package com.bw.contraller;

import com.bw.bean.Map1;

import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoContraller {
    @Autowired
    VoService voService;

    @RequestMapping("list1")
    public Map getList1(){
        List<Map> list = voService.getList1();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("list2")
    public Map getList2(){
        List<Map> list = voService.getList2();
        return SugarUtil.getMapData(list);
    }

    @RequestMapping("list3")
    public Map getList3(){
        List<String> list = new ArrayList<>();
        list.add("省份");
        list.add("性别");
        list.add("总金额");
        List<Map1> list1 = voService.getList3();
        return SugarUtil.getTablePlayData(list,list1);
    }

    @RequestMapping("list4")
    public Map getList4(){
        List<Map> list = voService.getList4();
        return SugarUtil.getPieData(list);
    }
}
